//柯里化案例
//''.match(/\s+/g) 查找字符串中是否有空白字符
//''.match(/\d+/g) 查找字符串中是否有数字

const _ = require('lodash')

const match = _.curry((reg, str) => str.match(reg))
const haveSpace = match(/\s+/g)
const haveNumber = match(/\d+/g)

const filter = _.curry((func, array) => array.filter(func))
const findSpace = filter(haveSpace)

console.log(haveSpace('hello world'))
console.log(haveNumber('123hello'))
console.log(filter(haveSpace,['John Conner', 'John_Donne']))
console.log(findSpace(['John Conner', 'John_Donne']))
